<template>
    <section class="user-item">
        <img class="user-item-avarta" @error="defaultAvatar" :src="props.userDetail.senderUserAvatar || '~/assets/images/logo.png'" alt="">
        <section class="user-item-user-detail">
            <p class="user-item-name" :class="[isHiddenText ? 'text-hidden' : '']" v-if="props.userDetail.name || props.userDetail.senderUserNickname">{{
                props.userDetail.name || props.userDetail.senderUserNickname }}</p>
            <p class="user-item-remak" :class="[isHiddenText ? 'text-hidden' : '']" v-if="props.userDetail.nickname">{{ props.userDetail.nickname }}</p>
            <p class="user-item-remak" :class="[isHiddenText ? 'text-hidden' : '']" v-if="props.userDetail.friendNickname">{{ props.userDetail.friendNickname
            }}</p>
            <p class="user-item-name" :class="[isHiddenText ? 'text-hidden' : '']" props.userDetail.email>{{ props.userDetail.email }}</p>
            <p class="user-item-remak" :class="[isHiddenText ? 'text-hidden' : '']" v-if="props.userDetail.remak || props.userDetail.message">备注：{{
                props.userDetail.remak || props.userDetail.message }}</p>
        </section>
    </section>
</template>

<script setup>
import { defaultAvatar } from '@/utils'

const props = defineProps({
    userDetail: {
        type: Object,
        default: () => ({
            name: '',
            remak: '',
            avarta: ''
        })
    },
    isHiddenText: {
        type: Boolean,
        default: true
    }
})
</script>

<style lang="scss">
.user-item {
    display: flex;
    align-items: center;
    color: #525252;

    .user-item-avarta {
        width: 40px;
        height: 40px;
        min-height: 40px;
        object-fit: cover;
    }

    .user-item-user-detail {
        font-size: 16px;
        margin-left: 10px;
    }

    .text-hidden {
        width: 70px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-item-remak {
        font-weight: normal;
        font-size: 13px;
        color: #858585;
    }
}
</style>